home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / Lex.cpt / Lex / LEXLIB.π folder / LMOVI.C < prev    next >
Text File  |  1990-06-13  |  1KB  |  50 lines

  1. /*
  2.   HEADER: CUG    nnn.nn;
  3.   TITLE:    LEX - A Lexical Analyser Generator
  4.   VERSION:       1.0 for IBM-PC
  5.   DATE:    Jan 30, 1985
  6.   DESCRIPTION:   A Lexical Analyser Generator. From UNIX
  7.   KEYWORDS:      Lexical Analyser Generator YACC C PREP
  8.   SYSTEM:    IBM-PC and Compatiables
  9.   FILENAME:      LMOVI.C
  10.   WARNINGS:      This program is not for the casual user. It will
  11.     be useful primarily to expert developers.
  12.   CRC:    N/A
  13.   SEE-ALSO:      YACC and PREP
  14.   AUTHORS:       Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:    UNIX Systems Manuals
  17. */
  18. /*
  19.  * Bob Denny     28-Aug-82  Remove reference to stdio.h
  20.  * Scott Guthery 20-Nov-83      Adapt for IBM PC & DeSmet C
  21.  */
  22.  
  23. #include    <stdio.h>
  24. #include    <ctype.h>
  25. #include    "lex.h"
  26.  
  27. _lmovi(ltab_ptr, the_char, state)
  28. register struct lextab *ltab_ptr;
  29. register int    the_char;
  30. register int    state;
  31. {
  32.     int base;
  33.  
  34.     while ((base = ltab_ptr->llbase[state]+the_char) > ltab_ptr->llnxtmax ||
  35.         ((int *)ltab_ptr->llcheck)[base] != state)
  36.         if (state != ltab_ptr->llendst)
  37.             {
  38.             /*
  39.              * This miscompiled on Decus C many years ago
  40.              *    state = ((int *)ltab_ptr->lldefault)[state];
  41.              */
  42.             state = ((int *)ltab_ptr->lldefault)[state];
  43.             /* state = base; */
  44.             }
  45.         else {
  46.             return(-1);
  47.             }
  48.     return(((int *)ltab_ptr->llnext)[base]);
  49.     }
  50.